/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package workforce.ui;

import java.util.Iterator;

/**
 *
 * @author TEComp
 */
public abstract class BaseUIWeb implements UIWeb {

    private boolean vskip = false;
    private Iterator<UIWeb> baseUIWeb = null;

    
    public BaseUIWeb() {
        
    }

    @Override
    public abstract String begin();

    @Override
        public String body() {
        StringBuilder s = new StringBuilder();
        if (baseUIWeb != null) {
            while (baseUIWeb.hasNext()) {
                UIWeb ui = (UIWeb) baseUIWeb.next();
                s.append(ui.print());
            }
            return s.toString();
        } else {
            return "";
        }
    }

    @Override
    public void setBody(Iterator<UIWeb> uiWeb) {
        this.baseUIWeb = uiWeb;
    }

    @Override
    public abstract String end();

    @Override
    public String print() {
        StringBuilder s = new StringBuilder();
        s.append(begin());
        if (!skip()) {
            s.append(body());
            s.append(end());
        }
        return s.toString();
    }

    @Override
    public boolean skip() {
        return vskip;
    }

    @Override
    public void skip(boolean s) {
        vskip = s;
    }
    
    
   
}
